using System;
using System.Collections.Generic;
using System.Data;

namespace SLIITPro.Data.Entity
{
    public class Comments
    {
        private string _id;
        private bool _isApproved;
        private DateTime _dateCreated;
        private string _content;
        private string _email;
        private string _author;
        private int _bId;

        public string Id { get { return _id; } set { _id = value; } }
        public int BId { get { return _bId; } set { _bId = value; } }
        public string Author { get { return _author; } set { _author = value; } }
        public string Email { get { return _email; } set { _email = value; } }
        public string Content { get { return _content; } set { _content = value; } }
        public DateTime DateCreated { get { return _dateCreated; } set { _dateCreated = value; } }
        public bool IsApproved { get { return _isApproved; } set { _isApproved = value; } }

        public Comments() { }

        public Comments(DataRow row)
        {
            if (row["cmId"] != DBNull.Value) Id = row["cmId"].ToString();
            if (row["cmBId"] != DBNull.Value) BId = int.Parse(row["cmBId"].ToString());
            if (row["cmAuthor"] != DBNull.Value) Author = row["cmAuthor"].ToString();
            if (row["cmEmail"] != DBNull.Value) Email = row["cmEmail"].ToString();
            if (row["cmDateCreated"] != DBNull.Value) DateCreated = DateTime.Parse(row["cmDateCreated"].ToString());
            if (row["cmContent"] != DBNull.Value) Content = row["cmContent"].ToString();
            if (row["cmIsApproved"] != DBNull.Value) IsApproved = Convert.ToBoolean(row["cmIsApproved"]);
        }
    }
}